package com.soa.zuul.entity;

import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.Version;

import org.hibernate.annotations.GenericGenerator;

import com.google.gson.annotations.Expose;

/**
 * GatewayUserServiceAuth entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "gateway_user_service_auth", schema = "public")
public class GatewayUserServiceAuth implements java.io.Serializable {

	// Fields

	private String id;
	@Expose
	private GatewayUser gatewayUser;
	@Expose
	private GatewayService gatewayService;
	private Date startDate;
	private Date endDate;
	private Integer limitNum;
	private Integer limitRateNum;
	private Integer limitNumLeft;
	private Integer limitRateNumLeft;
	private String state;
	private String memo;
	private Integer version;

	// Constructors

	/** default constructor */
	public GatewayUserServiceAuth() {
	}

	/** full constructor */
	public GatewayUserServiceAuth(GatewayUser gatewayUser,
			GatewayService gatewayService, Date startDate, Date endDate,
			Integer limitNum, Integer limitRateNum, Integer limitNumLeft,
			Integer limitRateNumLeft, String state, String memo, Integer version) {
		this.gatewayUser = gatewayUser;
		this.gatewayService = gatewayService;
		this.startDate = startDate;
		this.endDate = endDate;
		this.limitNum = limitNum;
		this.limitRateNum = limitRateNum;
		this.limitNumLeft = limitNumLeft;
		this.limitRateNumLeft = limitRateNumLeft;
		this.state = state;
		this.memo = memo;
		this.version = version;
	}

	// Property accessors
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@Id
	@GeneratedValue(generator = "generator")
	@Column(name = "id", unique = true, nullable = false, length = 32)
	public String getId() {
		return this.id;
	}

	public void setId(String id) {
		this.id = id;
	}


	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "user_id")
	public GatewayUser getGatewayUser() {
		return this.gatewayUser;
	}

	public void setGatewayUser(GatewayUser gatewayUser) {
		this.gatewayUser = gatewayUser;
	}
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "service_id")
	public GatewayService getGatewayService() {
		return this.gatewayService;
	}

	public void setGatewayService(GatewayService gatewayService) {
		this.gatewayService = gatewayService;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "start_date", length = 13)
	public Date getStartDate() {
		return this.startDate;
	}

	public void setStartDate(Date startDate) {
		this.startDate = startDate;
	}

	@Temporal(TemporalType.DATE)
	@Column(name = "end_date", length = 13)
	public Date getEndDate() {
		return this.endDate;
	}

	public void setEndDate(Date endDate) {
		this.endDate = endDate;
	}

	@Column(name = "limit_num")
	public Integer getLimitNum() {
		return this.limitNum;
	}

	public void setLimitNum(Integer limitNum) {
		this.limitNum = limitNum;
	}

	@Column(name = "limit_rate_num")
	public Integer getLimitRateNum() {
		return this.limitRateNum;
	}

	public void setLimitRateNum(Integer limitRateNum) {
		this.limitRateNum = limitRateNum;
	}

	@Column(name = "limit_num_left")
	public Integer getLimitNumLeft() {
		return this.limitNumLeft;
	}

	public void setLimitNumLeft(Integer limitNumLeft) {
		this.limitNumLeft = limitNumLeft;
	}

	@Column(name = "limit_rate_num_left")
	public Integer getLimitRateNumLeft() {
		return this.limitRateNumLeft;
	}

	public void setLimitRateNumLeft(Integer limitRateNumLeft) {
		this.limitRateNumLeft = limitRateNumLeft;
	}
	@Column(name = "state", length = 2)
	public String getState() {
		return this.state;
	}

	public void setState(String state) {
		this.state = state;
	}

	@Column(name = "memo", length = 4000)
	public String getMemo() {
		return this.memo;
	}

	public void setMemo(String memo) {
		this.memo = memo;
	}
	@Version
	@Column(name = "version")
	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}

}